import request from '@/utils/request'
/**
 * 获得图片验证码
 * @param {number} clientToken  请求的随机数
 * @returns promise
 */
export const getCodeAPI = (clientToken) => {
  return request({
    url: `/api/user-service/user/imageCode/${clientToken}`
    // responseType: 'blob'
  })
}

export const loginAPI = (data) => {
  return request({
    url: '/api/user-service/user/login',
    method: 'POST',
    data
  })
}
/**
 * 获取用户基本信息
 * @param {*} id 用户id
 * @returns promise
 */
export const getUserInfoAPI = (id) => {
  return request({
    url: `/api/user-service/user/${id}`
  })
}
/**
 * 获取角色列表
 * @param {*} data
 * @returns promise
 */
export const getUserRoleAPI = (data) => {
  return request({
    url: '/api/user-service/role',
    data
  })
}
/**
 * 获取用户工作量(工单统计)
 * @param {*} start 2020-10-01 00:00:00
 * @param {*} end 	2020-10-31 00:00:00
 * @returns promise
 */
export const getUserWorkAPI = () => {
  return request({
    url: 'api/task-service/task/taskReportInfo/2022-10-01%2000:00:00/2022-10-29%2023:59:59'

  })
}
/**
 * 获取一定时间范围之内的订单总数
 * @param {*} params start	是	2020-01-01 00:00:00	开始日期时间
 * @returns promise  end	是	2020-01-01 00:00:00	结束日期时间
 */
export const orderCountAPI = (params) => {
  return request({
    url: '/api/order-service/report/orderCount',
    params
  })
}
/**
 * 获取一定时间范围之内的收入
 * @param {*} params  start	是	2020-01-01 00:00:00	开始日期时间
 * @returns promise  end	是	2020-01-01 00:00:00	结束日期时间
 */
export const orderAmountAPI = (params) => {
  return request({
    url: '/api/order-service/report/orderAmount',
    params
  })
}

